﻿using UnityEngine;
using System.Collections;


public enum LoadTextureType
{
	Terrain = 0,
}

public enum GamePlayMode
{
	Single = 0,
	Multi,
}

public class GameCommon
{
    public enum GameMode : int
    {
        play = 0,
    }

    public static GameCommon.GameMode gameMode;

    public static void LoadScene(GameCommon.GameMode mode)
    {
        gameMode = mode;

        if (mode == GameMode.play)
        {
            Application.LoadLevelAdditive("GamePlayScene");
        }        
    }

    public static void UnLoadScene(GameCommon.GameMode mode)
    {
        GameObject go = null;

        if (mode == GameMode.play)
        {
            go = GameObject.Find("GamePlayScene");
        }

        if (go != null)
        {         
            GameObject.DestroyImmediate(go);
            Resources.UnloadUnusedAssets();
        }
    }

    public static GamePlayScene GetPlayScene()
    {
        GameObject gameObject = GameObject.Find("GamePlayScene");
        if (gameObject != null)
        {
            return gameObject.GetComponent<GamePlayScene>();
        }

        return null;
    }

	public static Texture2D GetTexture( string name, LoadTextureType type )
	{
		switch (type) 
		{
		case LoadTextureType.Terrain:
			return (Texture2D)Resources.Load("Terrain/Texture/" + name);
			
		}

		return null;
	}
}

public class Sphere
{
    public Sphere() { }

    public Sphere(Vector3 c, float r)
    {
        center = c;
        radius = r;
    }

    public Vector3 center;
    public float radius;
}

public enum CollState
{
    fail = 0,
    success,
    blocked,
}

public enum MoveDirection
{
    none = 0,
    left = -1,
    right = 1,
}